
const {ccclass, property} = cc._decorator;
import Enemy from './enemy'

@ccclass
export default class EnemyHit extends cc.Component {
    
    enemy: Enemy;
    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.enemy = this.node.parent.getComponent("enemy");
    }

    

    // 碰撞回调
    onCollisionEnter(other:cc.Component, self:cc.Component) {
        if (other.node.group == 'hero' && other.node.getComponent(cc.BoxCollider).tag == 1) {
            this.enemy.hurt();
        }
    }

    // update (dt) {}
}
